<!doctype html><html><head><title>relief.ServiceProvider</title><link href="../stylesheet.css" rel="stylesheet" type="text/css"></head><body><a href="../index.html">Home</a><h1>Class relief.ServiceProvider</h1><p>Service Provider

The service provider class is the enabler for dependency injection.  It
provides a mechanism for injecting arbitrary objects and values into other
systems at construction.  If a subsystem requires specific things be
injected into them, developers are encouraged to subclass ServiceProvider
with one that requires the needed subsystems as constructor arguments.
See relief.sp.NavServiceProvider for an example.</p>extends <a href="../goog/Disposable.html">goog.Disposable</a><table class="method-list"><tr><td colspan="2"><strong>Instance Method Summary</strong></td></tr><tr><td class="method-list-cell method-access method-protected"></td><td class="method-list-cell method-cell"><code>disposeInternal()</code><br><p class="method-description">Deletes or nulls out any references to COM objects, DOM nodes, or other
disposable objects. Classes that extend {@code goog.Disposable} should
override this method.
Not reentrant. To avoid calling it twice, it must only be called from the
subclass' {@code disposeInternal} method. Everywhere else the public
{@code dispose} method must be used.
For example:
<pre>
mypackage.MyClass = function() {
goog.base(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);

mypackage.MyClass.prototype.disposeInternal = function() {
goog.base(this, 'disposeInternal');
// Dispose logic specific to MyClass.
...
};
</pre></p></td></tr><tr><td class="method-list-cell method-access method-public"></td><td class="method-list-cell method-cell"><code>getResource(string name) &#8658; &lt;Any Type&gt;</code><br></td></tr><tr><td class="method-list-cell method-access method-public"></td><td class="method-list-cell method-cell"><code>setResource(string name, &lt;Any Type&gt; value)</code><br><p class="method-description">This method (and the corresponding getter) allow for injecting arbitrary
values via the ServiceProvider object.  If something was already inserted
with the same name, the existing value is passed to goog.dispose() and then
overwritten with the new value.</p></td></tr></table></body></html>